import request from "@/utils/service"
import type * as IArchitecture from "./types/index"

/** 获取单位信息 */
export function getUnitInfoApi() {
  return request<IArchitecture.ArchitectureResponseData<IArchitecture.IUnitInfo>>({
    url: "/api/v2/company/unitInfo",
    method: "get"
  })
}

/** 编辑单位信息 */
export function editUnitInfoApi(data: IArchitecture.IEditUnitInfoParams) {
  return request<IArchitecture.ArchitectureResponseData<any>>({
    url: "/api/v2/company/set",
    method: "post",
    data
  })
}

/**
 * 获取分区列表信息
 * @params device_type_id = 1 智能输液 2无线
 */
export function getAreaListApi(params: IArchitecture.IAreaParams) {
  return request<IArchitecture.ArchitectureListResponseData<IArchitecture.IPartitionListData[]>>({
    url: "/api/v2/area/getAreaList",
    method: "get",
    params
  })
}

/** 删除分区 */
export function delPartitionApi(data: { area_id: number }) {
  return request<IArchitecture.ArchitectureResponseData<any>>({
    url: "/api/v2/area/delArea",
    method: "delete",
    data
  })
}

/** 添加分区 */
export function addPartitionApi(data: IArchitecture.IAddPartitionParams) {
  return request<IArchitecture.ArchitectureResponseData<any>>({
    url: "/api/v2/area/addArea",
    method: "post",
    data
  })
}

/** 编辑分区 */
export function editPartitionApi(data: IArchitecture.IEditPartitionParams) {
  return request<IArchitecture.ArchitectureResponseData<any>>({
    url: "/api/v2/area/editArea",
    method: "put",
    data
  })
}

/** 获取接收器列表 */
export function getReceiverListApi(params: IArchitecture.IReceiverListParams) {
  return request<IArchitecture.ArchitectureListResponseData<IArchitecture.IReceiverListData[]>>({
    url: "/api/v2/lotDevice/getReceiverList",
    method: "get",
    params
  })
}

/** 编辑接收器列表 */
export function editReceiverApi(data: IArchitecture.IEditReceiverParams) {
  return request<IArchitecture.ArchitectureResponseData<any>>({
    url: "/api/v2/deviceReceiver/editReceiver",
    method: "put",
    data
  })
}
